home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / math / nrpas13 / qtrap.pas < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  359b  |  18 lines

  1. PROCEDURE qtrap(a,b: real;VAR s: real);
  2. LABEL 99;
  3. CONST
  4.    eps=1.0e-6;
  5.    jmax=20;
  6. VAR
  7.    j: integer;
  8.    olds: real;
  9. BEGIN
  10.    olds := -1.0e30;
  11.    FOR j := 1 TO jmax DO BEGIN
  12.       trapzd(a,b,s,j);
  13.       IF  (abs(s-olds) < eps*abs(olds)) THEN GOTO 99;
  14.       olds := s
  15.    END;
  16.    writeln ('pause in QTRAP - too many steps'); readln;
  17. 99:   END;
  18.